home *** CD-ROM | disk | FTP | other *** search
Java Source | 1996-10-04 | 3.2 KB | 112 lines |
- package sub_arctic.test;
-
- import sub_arctic.input.*;
- import sub_arctic.lib.*;
- import sub_arctic.output.*;
- import sub_arctic.constraints.std_function;
-
- /**
- * We are going to make a separate applet this time. This applet gets
- * embedded in a frame popped up by the main applet.
- */
- class frame_test_applet extends interactor_applet implements callback_object {
- public void build_ui(base_parent_interactor top) {
- button hide_button;
-
- /* put the button at 10, 10 and use 10 and 10 as the border sizes */
- hide_button=new button("Push Me Too!", this);
- top.add_child(hide_button);
- hide_button.set_x_constraint(std_function.centered(PARENT.X2(), 0));
- hide_button.set_y_constraint(std_function.centered(PARENT.Y2(),0));
- }
- /**
- * Called when they press the button
- */
- public void callback(interactor from_obj, event evt, int callback_num,
- Object callback_info) {
-
- System.out.println("Pressed the extra button");
- }
- }
-
- /**
- * This is the main applet.
- */
- public class frame_test2 extends interactor_applet implements callback_object
- {
- button show_button;
- interactor_frame iframe;
-
- public void build_ui(base_parent_interactor top) {
- /* put a button in */
- show_button=new button(0,0,"Push Me", this);
- top.add_child(show_button);
- /* center the button */
- show_button.set_x_constraint(std_function.centered(PARENT.X2(), 0));
- show_button.set_y_constraint(std_function.centered(PARENT.Y2(), 0));
- }
- /**
- * This gets called if we get uniconified, so we need to put the
- * frame back on the screen.
- */
- public void start() {
- if (iframe!=null) {
- iframe.show();
- }
- }
- /**
- * You get a call to stop if the browser gets iconified. We take
- * the window off the screen.
- */
- public void stop() {
- if (iframe!=null) {
- iframe.hide();
- }
- }
- /**
- * Create the extra frame.
- */
- public void newFrame() {
- /* if we already have a frame, don't need another one */
- if (iframe!=null) {
- return;
- }
-
- iframe=new interactor_frame("Test Frame", new frame_test_applet(),
- 200,150);
- /* if you called "setResizable() on iframe here you could force it
- * to never get bigger */
- iframe.set_callback_obj(this);
- iframe.show();
- }
- /**
- * Called when they press the button
- */
- public void callback(interactor from_obj, event evt, int callback_num,
- Object callback_info) {
- /* figure out who sent this */
- if (from_obj==show_button) {
- newFrame();
- } else {
- /* must be the top level telling use the user killed us */
- iframe=null;
- }
- }
- }
- /*=========================== COPYRIGHT NOTICE ===========================
-
- This file is part of the subArctic user interface toolkit.
-
- Copyright (c) 1996 Scott Hudson and Ian Smith
- All rights reserved.
-
- The subArctic system is freely available for most uses under the terms
- and conditions described in
- http://www.cc.gatech.edu/gvu/ui/sub_arctic/sub_arctic/doc/usage.html
- and appearing in full in the lib/interactor.java source file.
-
- The current release and additional information about this software can be
- found starting at: http://www.cc.gatech.edu/gvu/ui/sub_arctic/
-
- ========================================================================*/
-